﻿#ifndef _BULLET_H_
#define _BULLET_H_
#include "ui/CocosGUI.h"
#include "cocos2d.h"
enum BulletType {HeroBullet, WeaponBullet, EnemyBullet, SkillBullet};
class Bullet : public cocos2d::ui::Widget {
public:
	Bullet(BulletType bulletType, float bulletSpeed);
	static Bullet* create(BulletType bulletType, float bulletSpeed);
	bool init();
	void update(float dt);
	void initCSBFile();
	BulletType getBulletType()const {
		return bulletType;
	}
	void onEnter() override;
	void setLive(bool isLive) {
		live = isLive;
	}
	bool getLive() const {
		return live;
	}
	cocos2d::Rect getBulletRect();//返回自己的Rect
private:
	cocos2d::Node* root;
	cocos2d::Sprite* bullet;
	cocos2d::Sprite* bullet_boom;
	cocos2d::Size bulletSize;
	BulletType bulletType;
	int speed;
	bool live;
};
#endif // !_BULLET_H_



